//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "CQBTraining\fn_checkTargets.sqf"
#include <core_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

if (!isServer) exitWith {TRACE("Not Server");};

private ["_target","_time"];

if (IS_ARRAY(GVAR(CQB_Targets) ) && {count GVAR(CQB_Targets)  > 0}) then {
	waituntil { sleep 9.3456;
			if (GVAR(CQB_RePop)) then {
			{
				_target = _x;
				_time = _target getVariable ["PopUp",-1];
				if (_time > 0 && _time < time && {!(_target getVariable["IsUp",false])}) then {
					_target animate["terc", 0];
					_target setVariable["IsUp",true];
					_target setVariable["PopUp",-1];
					TRACE_1("Target Reset",ARR_2(_target,_time));
				};
			} foreach GVAR(CQB_Targets);
		};
		false;
	};
};

TRACE("End");
TMFPROFILERSTOP;
